<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1">


        <title>北京循一堂健康管理有限公司</title>

        <link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css">
		<link href="./plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" type="text/css">
        <link href="./plugins/bootstrap-datepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
       <link rel="stylesheet" type="text/css" href="./css/page.css"/>
    </head>


    <body class="fixed-left">
          <script src="./js/jquery.min.js"></script>
          <script type="text/javascript"> 
			$(function(){	
				$(".tab").slide({     //切换新闻
					titCell:".hd li",
					mainCell:".bd",
					targetCell:".more li",
					effect:"fade",
					autoPlay:false,
					trigger:"click",
					easing:"linear",
					delayTime:0
				});
				
				$(".yylb .tab").slide({     //切换新闻
					titCell:".hd li",
					mainCell:".bd",
					targetCell:".more li",
					effect:"fade",
					autoPlay:false,
					trigger:"click",
					easing:"linear",
					delayTime:0
				});

			});
			
			function ScrollImgLeft(){ 
			var speed=50; 
			var scroll_begin = document.getElementById("scroll_begin"); 
			var scroll_end = document.getElementById("scroll_end"); 
			var scroll_div = document.getElementById("scroll_div"); 
			scroll_end.innerHTML=scroll_begin.innerHTML; 
			function Marquee(){ 
			if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0) 
			scroll_div.scrollLeft-=scroll_begin.offsetWidth; 
			else 
			scroll_div.scrollLeft++; 
			} 
			var MyMar=setInterval(Marquee,speed); 
			scroll_div.onmouseover=function() {clearInterval(MyMar);} 
			scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed);} 
			} 
		</script> 
		<div class="header">
			<div class="container right-b clearfix">
				<div class="logo fl"><img src="./images/logo.jpg"/></div>
				
				<div class="center fl">									 
					<div style="width:96%;height:21px;margin:0 auto;white-space: nowrap;overflow:hidden;" id="scroll_div" class="scroll_div"> 
						<div id="scroll_begin"> 					
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
							<a href="#" target="_blank"><i>·</i><span>请各位医生完善个人基本信息    <b>2018-07-26</b></span></a>             					        				
						</div> 
						<div id="scroll_end"></div> 
					</div> 
					<script type="text/javascript">ScrollImgLeft();</script> 				 
				</div>
				
				<div class="data fr clearfix">
					<div class="tx">
						<img src="./images/logo.jpg" alt="" height="50"/>
					</div>	
					<div class="name">
						<button onclick="">退出登录</button>
						<p>欢迎胡凤亮医生<button onclick="" id="name"></button></p>
					</div>
					
					
				</div>
			</div>
		</div>
		<div class="main clearfix">
			<div class="tab fl">
						<div class="hd nav" id="contentDiv">
							<ul>
			                	<li class="nav_01"></li>
			                	<li class="nav_02"></li>
			                	<li class="nav_03"></li>
			                	<li class="nav_04"></li>
			                	<li class="nav_05"></li>
			                	<li class="nav_06"></li>
			                	<li class="nav_07"></li>
			                	<li class="nav_08"></li>
			                	<li class="nav_09"></li>
			                	<li class="nav_10"></li>
			                                    
			                </ul>
						</div>
			  
						<div class="bd container">
							<ul class="hzk">
								<div class="ss">
									<input type="text" name="" id="moreSearch" value="" />
									<button type="button">搜索</button>
								</div>
								
								<table id="userTable"></table>
	
							</ul>
								
						</div>
					</div>
			
		</div>
		<br>
		<br>
		<br>
		<br>
		<br>
		<div class="footer" style="left:0px">
			<p>版权所有  © 2018-2020 北京循一堂健康管理有限公司&nbsp;&nbsp;&nbsp;技术支持电话：010-62084321</p>
		</div>
        <script>
            var resizefunc = [];
        </script>

        <!-- jQuery  -->
        <script src="./js/bootstrap.min.js"></script>
        <script src="./plugins/select/js/bootstrap-select.min.js"></script>
    
        <script src="./plugins/bootstrap-table/bootstrap-table.min.js"></script>
        <script src="./plugins/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
        
        <script src="./plugins/bootstrap-datepicker/js/moment.js"></script>
        <script src="./plugins/bootstrap-datepicker/js/bootstrap-datetimepicker.min.js"></script>
        <script src="./js/jquery.SuperSlide.2.1.1.js" type="text/javascript" charset="utf-8"></script>
	
		<script type="text/javascript">
			window.baseUrl=localStorage.getItem("baseUrl");
			window.moreSearch="";
			console.log(localStorage.getItem("Authorization"));
            jQuery(document).ready(function($) {
   
				$.ajax({
					type: "POST",
					url: window.baseUrl+"/article",
					contentType: "application/json",
					dataType: "json",
					beforeSend: function(request) {                
							request.setRequestHeader("Authorization", localStorage.getItem("Authorization"));
					},
					success: function(data) {

					},
					error: function(data) {

					}
				});
					 return;
                $('#contentDiv').find('li').each(function() {
                    $(this).click(function() {
                        console.log($(this).index());
                        window.location.href="/annother?type="+$(this).index();
                    })
                });
                
            	$('#datetimepicker').datetimepicker({
            		format:"YYYY-MM-DD HH:MM:SS"
            	});  
            	
            	var $table = $('#userTable');
            	var $remove = $('#btn_delete'),
            	$add = $('#btn_add'),
            	$edit = $('#btn_edit'),
            	toolbar = "#userToolbar";

            	$table.bootstrapTable({
            		contentType: "application/x-www-form-urlencoded",
            		method:"post",
                    toolbar : toolbar,
                    showRefresh : true,
                    showToggle:true,
                    pagination:true,
                    showColumns:true,
                    idField : "id",
                    sortName : 'createtime',
                    sortOrder : 'desc',
                    pageSize: 10,
                    pageList: [10, 25, 50, 100],
                    queryParamsType:"",
                    queryParams:function(params) {
                    	//将查询条件添加到查询参数中，分页或者刷新时将携带这些参数
                    	params["moreSearch"] = window.moreSearch;
                    	params["pageNumber"] = params.pageNumber;
                    	params["pageSize"] = params.pageSize;
                    	params["sortOrder"]=params.sortOrder;
                    	params["sortName"]=params.sortName;
                    	return params;
                    }, 
                    sidePagination : "server",
                    url :window.baseUrl+"/article",
                    columns: [
                              /* {field:"state",checkbox:true}, */
                              {field: "id", title: "编号"},
                              {field: "name", title: "姓名",sortable: true}, 
                              {field: "sex", title: "性别",sortable: true},
                              {field: "age", title: "年龄",sortable: true},
                              {field: "history", title: "就医历史",sortable: true},
                              {field: "diagnose", title: "诊断",sortable: true},
                              {field: "bumen", title: "部门",sortable: true},
                              {field: "opt", title: "操作",
                             	 formatter:function(value,row){
                          			return '<button onclick="" class="b_ck fl"></button>'+
									'<button onclick="" class="b_fxx fl"></button>'+
									'<button onclick="" class="b_lh fl"></button>';
                               	  }
                              }
                              
                    ]
                });
                $table.on('check.bs.table uncheck.bs.table ' +
                        'check-all.bs.table uncheck-all.bs.table', function () {
                    initBtnStatus();
                });
                
              	//数据已添加到table中，onPostBody
                $table.on('post-body.bs.table',function(data){
                	initBtnStatus();
                	//为按钮绑定事件
                	$table.find(".detailBtn").click(function(){
                		window.open("http://hrfile.zcwjvr.com/file/down/"+$(this).data().id);
                    });
                });
              
              	//数据加载完成事件，onLoadSuccess
                $table.on('load-success.bs.table',function(){
                	initBtnStatus();
                });
                function initBtnStatus(){
                	var len = $table.bootstrapTable('getSelections').length;
                    $remove.prop('disabled', !len);
                    $edit.prop('disabled', len!=1);
                }
                function getFileIdSelections() {
                    return $.map($table.bootstrapTable('getSelections'), function (row) {
                        return row.fileid
                    });
                }
                function getIdSelections() {
                    return $.map($table.bootstrapTable('getSelections'), function (row) {
                        return row.id
                    });
                }
                
                $add.click(function () {
					window.location.href="/jianliAdd";
                });
                
                $edit.click(function () {
                	$.map($table.bootstrapTable('getSelections'), function (row) {
                        $("#userName").val(row.uname);
                        $("#userSex").val(row.usex);
                        $("#userAge").val(row.xueli);
                        $("#userJob").val(row.roll);
                        $("#userBumen").selectpicker('val',row.bumen);
                        $("#userChannel").val(row.fro);
                        $("#userTime").val(row.disptime);
                        $("#userAttention").val(row.focus_member);
                        $('#userStatus').selectpicker('val',row.zhuangtai);
                        $("#userMemo").val(row.memo);
                        $("#datetimepicker").val(row.meettime);
                    });
                	
                });
                $("#saveBtn").click(function(){
                	var ids = getIdSelections();
                	var userStatus=$('#userStatus').val();
                	var userMemo=$('#userMemo').val();
                	var userInfo=$('#userInfo').val();
                	var userBumen=$('#userBumen').val();
                	var meettime=$("#datetimepicker").val();
					 $.ajax({
					    	url: "/updateJianli?id="+ids[0]+"&status="+userStatus+"&memo="+userMemo+"&bumen="+userBumen+"&meettime="+meettime,
					    	type: "GET",
					    	success:function (result){
					    		if (result.success==true){
					    			sweetAlert('更新成功');	
					    			refresh();
					    		}else{
					    			sweetAlert('更新失败,请重试!');	
					    			refresh();
					    		}
					    	}
				   });
                });
                $("#editPwdBtn").click(function () {
             	   var pwd = $("#newpwd").val();
            	   var pwd2 = $("#newpwd2").val();

            	   if(pwd == ""  ){
            	     alert("密码不能为空");
            	     return false;
            	   }
            	   if(pwd2 == ""  ){
            	    alert("密码不能为空");
            	     return false;
            	   }
            	   if(pwd != pwd2 ){
            		    alert("两次密码不一致");
            		     return false;
            		  }
					 $.ajax({
					    	url: "/modifypwd?pid=${member.member_id}&pname=${member.username}&newpwd="+pwd,
					    	type: "GET",
					    	success:function (result){
					    		sweetAlert('更新成功');	
					    	}
				   });
                });
                //刷新并跳转到第一页页面
                function refresh(){
                	//刷新并跳转到第一页
                	$table.bootstrapTable('selectPage',1);
                	//$table.bootstrapTable('refresh');
                };
                $("#btn_query").click(function(){
                	window.searchName=$("#searchName").val();
                	window.searchFocus=$("#searchFocus").val();
                	window.searchSex=$("#searchSex").val();
                	window.searchFrom=$("#searchFrom").val();
                	window.searchTo=$("#searchTo").val();
                	window.searchJob=$("#searchJob").val();
                	window.searchChannel=$("#searchChannel").val();
                	window.searchStatus=$("#searchStatus").val();
                	window.searchBumen=$("#searchBumen").val();
                	refresh();
                });
                $("#btn_more_query").click(function(){
                	window.moreSearch=$("#moreSearch").val();
                	refresh();
                });
            });
        </script>

    
    </body>
</html>